home *** CD-ROM | disk | FTP | other *** search
- function playSound($soundObj)
- {
- var _loc1_ = $soundObj;
- if(_loc1_.position == 0 || _loc1_.position == _loc1_.duration)
- {
- _loc1_.start();
- }
- }
- function playPelletSound()
- {
- pelletSound2.start();
- }
- function TileClass($walkable, $frame, $style)
- {
- var _loc1_ = this;
- _loc1_.walkable = $walkable;
- _loc1_.frame = $frame;
- _loc1_.style = $style;
- }
- function DoorClass($newCharX, $newCharY)
- {
- var _loc1_ = this;
- _loc1_.newCharX = $newCharX;
- _loc1_.newCharY = $newCharY;
- _loc1_.newMap = 1;
- _loc1_.frame = 20;
- _loc1_.walkable = true;
- _loc1_.style = "door";
- }
- function getMyCorners($x, $y, $ob)
- {
- var _loc1_ = $ob;
- _loc1_.downY = Math.floor(($y + _loc1_.height) / game.tileH);
- _loc1_.upY = Math.floor(($y - _loc1_.height) / game.tileH);
- _loc1_.leftX = Math.floor(($x - _loc1_.width) / game.tileW);
- _loc1_.rightX = Math.floor(($x + _loc1_.width) / game.tileW);
- _loc1_.upLeft = game["tile" + _loc1_.upY + "_" + _loc1_.leftX].walkable;
- _loc1_.upRight = game["tile" + _loc1_.upY + "_" + _loc1_.rightX].walkable;
- _loc1_.downLeft = game["tile" + _loc1_.downY + "_" + _loc1_.leftX].walkable;
- _loc1_.downRight = game["tile" + _loc1_.downY + "_" + _loc1_.rightX].walkable;
- §§push(_loc1_);
- if(_loc1_ == _root.hero)
- {
- if(!_loc1_.upLeft)
- {
- _loc1_.upLeft = game["tile" + _loc1_.upY + "_" + _loc1_.leftX].style == "openGoalDoor";
- }
- if(!_loc1_.upRight)
- {
- _loc1_.upRight = game["tile" + _loc1_.upY + "_" + _loc1_.rightX].style == "openGoalDoor";
- }
- if(!_loc1_.downLeft)
- {
- _loc1_.downLeft = game["tile" + _loc1_.downY + "_" + _loc1_.leftX].style == "openGoalDoor";
- }
- if(!_loc1_.downRight)
- {
- _loc1_.downRight = game["tile" + _loc1_.downY + "_" + _loc1_.rightX].style == "openGoalDoor";
- }
- }
- var _loc0_ = _loc1_.upLeft && _loc1_.downLeft && _loc1_.upRight && _loc1_.downRight;
- _loc1_ = §§pop();
- return _loc0_;
- }
- function moveChar($ob, $dirX, $dirY)
- {
- var _loc1_ = $ob;
- var _loc3_ = _root;
- if(getMyCorners(_loc1_.x + _loc1_.speed * $dirX,_loc1_.y + _loc1_.speed * $dirY,_loc1_))
- {
- _loc1_.y += _loc1_.speed * $dirY;
- _loc1_.x += _loc1_.speed * $dirX;
- _loc1_.clip._x = _loc1_.x;
- _loc1_.clip._y = _loc1_.y;
- _loc1_.xTile = Math.floor(_loc1_.clip._x / game.tileW);
- _loc1_.ytile = Math.floor(_loc1_.clip._y / game.tileH);
- _loc1_.clip.gotoAndStop(_loc1_.curDir);
- if(_loc1_ == _loc3_.hero)
- {
- if(game.totalPellets > 0)
- {
- var _loc2_ = "tile" + _loc1_.yTile + "_" + _loc1_.xTile;
- switch(game[_loc2_].style)
- {
- case "pellet":
- game[_loc2_] = _loc3_.Tile1;
- game.clip[_loc2_].gotoAndStop(game[_loc2_].frame);
- game.totalPellets--;
- score += 10;
- playPelletSound();
- break;
- case "powerPellet":
- game[_loc2_] = _loc3_.Tile1;
- game.clip[_loc2_].gotoAndStop(game[_loc2_].frame);
- game.totalPellets--;
- score += 20;
- powerUp();
- playSound(ppSound);
- break;
- case "keyLeft":
- playSound(keySound);
- game[_loc2_] = _loc3_.Tile1;
- game.clip[_loc2_].gotoAndStop(game[_loc2_].frame);
- game["tile" + _loc1_.yTile + "_" + (_loc1_.xTile + 1)] = _loc3_.Tile1;
- game.clip["tile" + _loc1_.yTile + "_" + (_loc1_.xTile + 1)].gotoAndStop(game[_loc2_].frame);
- game["tile" + _loc1_.yTile + "_" + (_loc1_.xTile + 2)] = _loc3_.Tile1;
- game.clip["tile" + _loc1_.yTile + "_" + (_loc1_.xTile + 2)].gotoAndStop(game[_loc2_].frame);
- game.totalPellets -= 3;
- score += 30;
- break;
- case "keyMiddle":
- playSound(keySound);
- game[_loc2_] = _loc3_.Tile1;
- game.clip[_loc2_].gotoAndStop(game[_loc2_].frame);
- game["tile" + _loc1_.yTile + "_" + (_loc1_.xTile - 1)] = _loc3_.Tile1;
- game.clip["tile" + _loc1_.yTile + "_" + (_loc1_.xTile - 1)].gotoAndStop(game[_loc2_].frame);
- game["tile" + _loc1_.yTile + "_" + (_loc1_.xTile + 1)] = _loc3_.Tile1;
- game.clip["tile" + _loc1_.yTile + "_" + (_loc1_.xTile + 1)].gotoAndStop(game[_loc2_].frame);
- game.totalPellets -= 3;
- score += 30;
- break;
- case "keyRight":
- playSound(keySound);
- game[_loc2_] = _loc3_.Tile1;
- game.clip[_loc2_].gotoAndStop(game[_loc2_].frame);
- game["tile" + _loc1_.yTile + "_" + (_loc1_.xTile - 2)] = _loc3_.Tile1;
- game.clip["tile" + _loc1_.yTile + "_" + (_loc1_.xTile - 2)].gotoAndStop(game[_loc2_].frame);
- game["tile" + _loc1_.yTile + "_" + (_loc1_.xTile - 1)] = _loc3_.Tile1;
- game.clip["tile" + _loc1_.yTile + "_" + (_loc1_.xTile - 1)].gotoAndStop(game[_loc2_].frame);
- game.totalPellets -= 3;
- score += 30;
- }
- if(game.totalPellets == 0)
- {
- game[game.goalDoor] = _loc3_.Tile11;
- game.clip[game.goalDoor].gotoAndStop(game[game.goalDoor].frame);
- game.clip.cage.gotoAndPlay("open");
- }
- }
- else if(game["tile" + _loc1_.yTile + "_" + _loc1_.xTile].style == "goal")
- {
- game.interaction = false;
- levelUp.gotoAndPlay("reveal");
- }
- }
- if(game["tile" + _loc1_.yTile + "_" + _loc1_.xTile].style == "door")
- {
- changeMap(_loc1_);
- }
- return true;
- }
- if(_loc1_ == _loc3_.hero)
- {
- heroChangeDirections();
- return false;
- }
- _loc1_.x = (_loc1_.xTile + 0.5) * game.tileW;
- _loc1_.y = (_loc1_.yTile + 0.5) * game.tileH;
- _loc1_.clip._x = _loc1_.x;
- _loc1_.clip._y = _loc1_.y;
- }
- function EnemyClass($dir)
- {
- var _loc1_ = this;
- _loc1_.dir = 2;
- _loc1_.speeds = {normal:5.25,afraid:3,eaten:0,grace:5.25};
- _loc1_.speed = _loc1_.speeds.normal;
- _loc1_.iq = base10;
- _loc1_.state = "normal";
- _loc1_.grace = 0;
- }
- function enemyBrain()
- {
- var i = 0;
- while(i < game.currentEnemies)
- {
- var enemyName = "enemy" + i;
- var _loc1_ = game[enemyName];
- if(_loc1_.state == "eaten")
- {
- if(--_loc1_.reviveCount <= 0)
- {
- _loc1_.xTile = 11;
- _loc1_.yTile = 1;
- _loc1_.x = (_loc1_.xTile + 0.5) * game.tileW;
- _loc1_.y = (_loc1_.yTile + 0.5) * game.tileH;
- _loc1_.clip._x = _loc1_.x;
- _loc1_.clip._y = _loc1_.y;
- _loc1_.dir = 3;
- _loc1_.state = "grace";
- _loc1_.clip.gotoAndPlay("grace");
- _loc1_.grace = 20;
- }
- }
- else
- {
- _loc1_.speed = _loc1_.speeds[_loc1_.state];
- if(_loc1_.x == (_loc1_.xTile + 0.5) * game.tileW && _loc1_.y == (_loc1_.yTile + 0.5) * game.tileH)
- {
- var motionChoice = "roam";
- switch(_loc1_.state)
- {
- case "grace":
- _loc1_.grace = _loc1_.grace - 1;
- if(_loc1_.grace <= 0)
- {
- _loc1_.state = "normal";
- _loc1_.clip.gotoAndPlay("normal");
- }
- break;
- case "afraid":
- var motionChoice = "flee";
- break;
- default:
- if(Math.abs(_loc1_.xTile - hero.xTile) <= 6 && Math.abs(_loc1_.yTile - hero.yTile) <= 6)
- {
- if(Math.random() * 100 < Math.min(90,30 + 5 * game.level))
- {
- motionChoice = "hunt";
- }
- break;
- }
- if(_loc1_.xTile == hero.xTile || _loc1_.yTile == hero.yTile)
- {
- if(Math.random() * 100 < Math.min(90,30 + 5 * game.level))
- {
- motionChoice = "hunt";
- }
- }
- break;
- }
- var reverseDir = 0;
- switch(_loc1_.dir)
- {
- case 1:
- reverseDir = 3;
- break;
- case 2:
- reverseDir = 4;
- break;
- case 3:
- reverseDir = 1;
- break;
- case 4:
- reverseDir = 2;
- }
- switch(motionChoice)
- {
- case "flee":
- var dirChoices = [];
- dirChoices.push(null);
- dirChoices.push(game["tile" + (_loc1_.yTile - 1) + "_" + _loc1_.xTile].walkable && _loc1_.dir != 3);
- dirChoices.push(game["tile" + _loc1_.yTile + "_" + (_loc1_.xTile + 1)].walkable && _loc1_.dir != 4);
- dirChoices.push(game["tile" + (_loc1_.yTile + 1) + "_" + _loc1_.xTile].walkable && _loc1_.dir != 1);
- dirChoices.push(game["tile" + _loc1_.yTile + "_" + (_loc1_.xTile - 1)].walkable && _loc1_.dir != 2);
- var _loc2_ = new Array();
- var _loc3_ = random(2) != 0 ? -1 : 1;
- if(Math.abs(hero.xTile - _loc1_.xTile) >= Math.abs(hero.yTile - _loc1_.yTile))
- {
- if(hero.xTile < _loc1_.xTile)
- {
- if(dirChoices[2])
- {
- _loc2_.push(2);
- }
- if(dirChoices[2 - _loc3_])
- {
- _loc2_.push(2 - _loc3_);
- }
- if(dirChoices[2 + _loc3_])
- {
- _loc2_.push(2 + _loc3_);
- }
- if(dirChoices[4])
- {
- _loc2_.push(4);
- }
- }
- else
- {
- if(dirChoices[4])
- {
- _loc2_.push(4);
- }
- if(dirChoices[2 - _loc3_])
- {
- _loc2_.push(2 - _loc3_);
- }
- if(dirChoices[2 + _loc3_])
- {
- _loc2_.push(2 + _loc3_);
- }
- if(dirChoices[2])
- {
- _loc2_.push(2);
- }
- }
- }
- else if(hero.yTile < _loc1_.yTile)
- {
- if(dirChoices[3])
- {
- _loc2_.push(3);
- }
- if(dirChoices[3 - _loc3_])
- {
- _loc2_.push(3 - _loc3_);
- }
- if(dirChoices[3 + _loc3_])
- {
- _loc2_.push(3 + _loc3_);
- }
- if(dirChoices[1])
- {
- _loc2_.push(1);
- }
- }
- else
- {
- if(dirChoices[1])
- {
- _loc2_.push(1);
- }
- if(dirChoices[3 - _loc3_])
- {
- _loc2_.push(3 - _loc3_);
- }
- if(dirChoices[3 + _loc3_])
- {
- _loc2_.push(3 + _loc3_);
- }
- if(dirChoices[3])
- {
- _loc2_.push(3);
- }
- }
- var dirX = 0;
- var dirY = 0;
- _loc1_.dir = _loc2_[0];
- break;
- case "hunt":
- var dirChoices = [];
- dirChoices.push(null);
- dirChoices.push(game["tile" + (_loc1_.yTile - 1) + "_" + _loc1_.xTile].walkable && _loc1_.dir != 3);
- dirChoices.push(game["tile" + _loc1_.yTile + "_" + (_loc1_.xTile + 1)].walkable && _loc1_.dir != 4);
- dirChoices.push(game["tile" + (_loc1_.yTile + 1) + "_" + _loc1_.xTile].walkable && _loc1_.dir != 1);
- dirChoices.push(game["tile" + _loc1_.yTile + "_" + (_loc1_.xTile - 1)].walkable && _loc1_.dir != 2);
- _loc2_ = new Array();
- _loc3_ = random(2) != 0 ? -1 : 1;
- if(Math.abs(hero.xTile - _loc1_.xTile) >= Math.abs(hero.yTile - _loc1_.yTile))
- {
- if(hero.xTile < _loc1_.xTile)
- {
- if(dirChoices[4])
- {
- _loc2_.push(4);
- }
- if(dirChoices[2 - _loc3_])
- {
- _loc2_.push(2 - _loc3_);
- }
- if(dirChoices[2 + _loc3_])
- {
- _loc2_.push(2 + _loc3_);
- }
- if(dirChoices[2])
- {
- _loc2_.push(2);
- }
- }
- else
- {
- if(dirChoices[2])
- {
- _loc2_.push(2);
- }
- if(dirChoices[2 - _loc3_])
- {
- _loc2_.push(2 - _loc3_);
- }
- if(dirChoices[2 + _loc3_])
- {
- _loc2_.push(2 + _loc3_);
- }
- if(dirChoices[4])
- {
- _loc2_.push(4);
- }
- }
- }
- else if(hero.yTile < _loc1_.yTile)
- {
- if(dirChoices[1])
- {
- _loc2_.push(1);
- }
- if(dirChoices[3 - _loc3_])
- {
- _loc2_.push(3 - _loc3_);
- }
- if(dirChoices[3 + _loc3_])
- {
- _loc2_.push(3 + _loc3_);
- }
- if(dirChoices[3])
- {
- _loc2_.push(3);
- }
- }
- else
- {
- if(dirChoices[3])
- {
- _loc2_.push(3);
- }
- if(dirChoices[3 - _loc3_])
- {
- _loc2_.push(3 - _loc3_);
- }
- if(dirChoices[3 + _loc3_])
- {
- _loc2_.push(3 + _loc3_);
- }
- if(dirChoices[1])
- {
- _loc2_.push(1);
- }
- }
- var dirX = 0;
- var dirY = 0;
- _loc1_.dir = _loc2_[0];
- break;
- case "roam":
- var dirChoices = [];
- if(game["tile" + (_loc1_.yTile - 1) + "_" + _loc1_.xTile].walkable && _loc1_.dir != 3)
- {
- dirChoices.push(1);
- }
- if(game["tile" + _loc1_.yTile + "_" + (_loc1_.xTile + 1)].walkable && _loc1_.dir != 4)
- {
- dirChoices.push(2);
- }
- if(game["tile" + (_loc1_.yTile + 1) + "_" + _loc1_.xTile].walkable && _loc1_.dir != 1)
- {
- dirChoices.push(3);
- }
- if(game["tile" + _loc1_.yTile + "_" + (_loc1_.xTile - 1)].walkable && _loc1_.dir != 2)
- {
- dirChoices.push(4);
- }
- if(!(Math.abs(dirChoices[0] - reverseDir) == 2 && dirChoices.length == 1))
- {
- _loc1_.dir = dirChoices[Math.floor(Math.random() * dirChoices.length)];
- }
- }
- }
- _loc1_.clip.dir = _loc1_.dir;
- var dirX = 0;
- var dirY = 0;
- switch(_loc1_.dir)
- {
- case 1:
- dirX = 0;
- dirY = -1;
- break;
- case 2:
- dirX = 1;
- dirY = 0;
- break;
- case 3:
- dirX = 0;
- dirY = 1;
- break;
- case 4:
- dirX = -1;
- dirY = 0;
- }
- moveChar(_loc1_,dirX,dirY);
- var xDist = _loc1_.x - hero.x;
- var yDist = _loc1_.y - hero.y;
- if(Math.sqrt(xDist * xDist + yDist * yDist) < _loc1_.width + hero.width + 5)
- {
- if(_loc1_.state == "normal")
- {
- playSound(deathSound);
- game.interaction = false;
- hero.clip.gotoAndPlay("die");
- livesDisplay.removeOne();
- }
- else if(_loc1_.state == "afraid")
- {
- playSound(deadEnemySound);
- _loc1_.state = "eaten";
- game.eatenEnemies = game.eatenEnemies + 1;
- var eatenPoints = 10 * game.eatenEnemies;
- score += eatenPoints;
- _loc1_.clip.pointValue = eatenPoints;
- _loc1_.clip.gotoAndPlay("eaten");
- _loc1_.reviveCount = 100;
- }
- }
- }
- i++;
- }
- }
- function moveHero()
- {
- var _loc1_ = _root.hero;
- var _loc3_ = 0;
- var _loc2_ = 0;
- if(_loc1_.nextDir != 0)
- {
- var nextDirX = 0;
- var nextDirY = 0;
- switch(_loc1_.nextDir)
- {
- case 5:
- nextDirX = 0;
- nextDirY = 0;
- break;
- case 1:
- nextDirX = 0;
- nextDirY = -1;
- break;
- case 2:
- nextDirX = 1;
- nextDirY = 0;
- break;
- case 3:
- nextDirX = 0;
- nextDirY = 1;
- break;
- case 4:
- nextDirX = -1;
- nextDirY = 0;
- }
- if(getMyCorners(_loc1_.x + _loc1_.speed * nextDirX,_loc1_.y + _loc1_.speed * nextDirY,_loc1_))
- {
- _loc1_.curDir = _loc1_.nextDir;
- _loc1_.nextDir = 0;
- _loc3_ = nextDirX;
- _loc2_ = nextDirY;
- }
- }
- if(_loc3_ == 0 && _loc2_ == 0)
- {
- switch(_loc1_.curDir)
- {
- case 1:
- _loc3_ = 0;
- _loc2_ = -1;
- break;
- case 2:
- _loc3_ = 1;
- _loc2_ = 0;
- break;
- case 3:
- _loc3_ = 0;
- _loc2_ = 1;
- break;
- case 4:
- _loc3_ = -1;
- _loc2_ = 0;
- }
- }
- moveChar(_loc1_,_loc3_,_loc2_);
- }
- function heroChangeDirections()
- {
- hero.curDir = hero.nextDir;
- hero.nextDir = 0;
- }
- function buildMap($map, $buildMap)
- {
- game.clip = _root.tiles;
- if($buildMap)
- {
- level = game.level;
- var mapWidth = $map[0].length;
- var mapHeight = $map.length;
- var i = 0;
- while(i < mapHeight)
- {
- var _loc3_ = 0;
- while(_loc3_ < mapWidth)
- {
- var _loc1_ = "tile" + i + "_" + _loc3_;
- game[_loc1_] = _root["Tile" + $map[i][_loc3_]];
- switch(game[_loc1_].style)
- {
- case "pellet":
- case "powerPellet":
- case "keyLeft":
- case "keyMiddle":
- case "keyRight":
- game.totalPellets = game.totalPellets + 1;
- break;
- case "goalDoor":
- game.goalDoor = _loc1_;
- break;
- }
- game.clip.attachMovie("tile",_loc1_,i * 100 + _loc3_ * 2);
- game.clip[_loc1_]._x = _loc3_ * game.tileW;
- game.clip[_loc1_]._y = i * game.tileH;
- game.clip[_loc1_].gotoAndStop(game[_loc1_].frame);
- _loc3_ = _loc3_ + 1;
- }
- i++;
- }
- }
- var enemies = enemyList[game.currentMap];
- game.currentEnemies = enemies.length;
- var i = 0;
- while(i < game.currentEnemies)
- {
- var _loc2_ = "enemy" + i;
- game[_loc2_] = _root["Enemy" + enemies[i][0]];
- game.clip.attachMovie("enemy" + enemies[i][0],_loc2_,10001 + i);
- game[_loc2_].state = "normal";
- game[_loc2_].clip = game.clip[_loc2_];
- game[_loc2_].xTile = enemies[i][1];
- game[_loc2_].yTile = enemies[i][2];
- game[_loc2_].width = 6.9;
- game[_loc2_].height = 6.9;
- game[_loc2_].x = game[_loc2_].xTile * game.tileW + game.tileW / 2;
- game[_loc2_].y = game[_loc2_].yTile * game.tileH + game.tileH / 2;
- game[_loc2_].clip._x = game[_loc2_].x;
- game[_loc2_].clip._y = game[_loc2_].y;
- i++;
- }
- game.clip.attachMovie("hero","hero",10000);
- hero.clip = game.clip.hero;
- hero.clip.gotoAndStop(2);
- hero.curDir = 0;
- hero.nextDir = 0;
- hero.xTile = 11;
- hero.yTile = 15;
- hero.x = hero.xTile * game.tileW + game.tileW / 2;
- hero.y = hero.yTile * game.tileH + game.tileH / 2;
- hero.width = 6.9;
- hero.height = 6.9;
- hero.clip._x = hero.x;
- hero.clip._y = hero.y;
- game.powerUp = 0;
- }
- function changeMap($ob)
- {
- var _loc1_ = $ob;
- var _loc2_ = "tile" + _loc1_.yTile + "_" + _loc1_.xTile;
- _loc1_.yTile = game[_loc2_].newCharY;
- _loc1_.xTile = game[_loc2_].newCharX;
- _loc1_.x = _loc1_.xTile * game.tileW + game.tileW / 2;
- _loc1_.y = _loc1_.yTile * game.tileH + game.tileH / 2;
- }
- function powerUp()
- {
- if(game.powerUp == 0)
- {
- game.eatenEnemies = 0;
- }
- game.powerUp = 250;
- var _loc2_ = 0;
- while(_loc2_ < game.currentEnemies)
- {
- var _loc1_ = game["enemy" + _loc2_];
- if(_loc1_.state == "normal" || _loc1_.state == "grace")
- {
- _loc1_.state = "afraid";
- _loc1_.clip.gotoAndPlay("afraid");
- switch(_loc1_.dir)
- {
- case 1:
- _loc1_.dir = 3;
- break;
- case 2:
- _loc1_.dir = 4;
- break;
- case 3:
- _loc1_.dir = 1;
- break;
- case 4:
- _loc1_.dir = 2;
- }
- }
- _loc2_ = _loc2_ + 1;
- }
- }
- function powerUpCount()
- {
- if(game.powerUp == 0)
- {
- var _loc1_ = 0;
- while(_loc1_ < game.currentEnemies)
- {
- var _loc2_ = "enemy" + _loc1_;
- if(game[_loc2_].state == "afraid")
- {
- game[_loc2_].state = "normal";
- game[_loc2_].clip.gotoAndPlay("normal");
- }
- _loc1_ = _loc1_ + 1;
- }
- }
- else
- {
- loop2:
- switch(game.powerUp)
- {
- case 10:
- case 22:
- case 34:
- case 46:
- case 58:
- case 70:
- _loc1_ = 0;
- while(true)
- {
- if(_loc1_ >= game.currentEnemies)
- {
- break loop2;
- }
- _loc2_ = "enemy" + _loc1_;
- if(game[_loc2_].state == "afraid")
- {
- game[_loc2_].clip.gotoAndPlay("blink");
- }
- _loc1_ = _loc1_ + 1;
- }
- }
- game.powerUp--;
- }
- }
- function onHeroDeath()
- {
- if(--game.lives <= 0)
- {
- gotoAndStop("gameOver");
- play();
- }
- else
- {
- buildMap(_root["map" + game.currentMap],false);
- countdown.gotoAndPlay(1);
- }
- }
- function onLevelUp()
- {
- game.level = game.level + 1;
- game.clip.bg.nextFrame();
- game.clip.cage.gotoAndPlay("closed");
- buildMap(_root["map" + game.currentMap],true);
- countdown.gotoAndPlay(1);
- }
- game = {tileW:21,tileH:21,currentMap:1,totalPellets:0,goalDoor:null,interaction:false,level:1,lives:3,score:0,powerUp:0,eatenEnemies:0};
- score = 0;
- level = 0;
- livesDisplay.reset();
- unInstBtn._visible = false;
- pelletSound = new Sound();
- pelletSound.attachSound("pelletSound");
- pelletSound2 = new Sound();
- pelletSound2.attachSound("pelletSound2");
- ppSound = new Sound();
- ppSound.attachSound("ppSound");
- keySound = new Sound();
- keySound.attachSound("keySound");
- deadEnemySound = new Sound();
- deadEnemySound.attachSound("deadEnemySound");
- deathSound = new Sound();
- deathSound.attachSound("deathSound");
- var pelletBool = true;
- map1 = [[0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0],[0,2,3,2,0,4,5,6,0,0,0,2,0,0,0,4,5,6,0,2,3,2,0],[0,2,0,2,0,2,0,2,0,0,0,2,0,0,0,2,0,2,0,2,0,2,0],[0,2,0,2,2,2,0,2,0,0,0,2,0,0,0,2,0,2,2,2,0,2,0],[0,2,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,2,0],[0,2,2,2,2,2,2,2,2,2,4,5,6,2,2,2,2,2,2,2,0,2,0],[0,2,0,0,0,2,0,0,0,0,0,2,0,0,0,2,0,2,0,0,0,2,0],[0,2,0,0,0,2,2,2,0,2,2,2,2,2,2,2,0,2,2,2,0,2,0],[0,2,0,0,0,2,0,2,0,2,0,7,0,2,0,2,0,2,0,2,0,2,0],[0,2,2,2,2,2,0,2,2,2,0,1,0,2,0,2,2,2,0,2,2,2,0],[0,2,0,0,0,2,0,0,0,2,0,10,0,2,0,0,0,2,0,0,0,2,0],[0,2,2,2,2,2,0,2,2,2,0,0,0,2,0,2,2,2,0,2,2,2,0],[0,2,0,0,0,2,0,2,0,2,0,0,0,2,0,2,0,2,0,2,0,2,0],[0,2,0,0,0,2,2,2,0,2,2,2,2,2,2,2,0,2,2,2,0,2,0],[0,2,0,0,0,2,0,0,0,0,0,2,0,0,0,2,0,2,0,0,0,2,0],[0,2,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,0,2,0],[0,2,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,2,0],[0,2,0,2,2,2,0,2,0,0,0,2,0,0,0,2,0,2,2,2,0,2,0],[0,2,0,2,0,2,0,2,0,0,0,2,0,0,0,2,0,2,0,2,0,2,0],[0,2,3,2,0,4,5,6,0,0,0,2,0,0,0,4,5,6,0,2,3,2,0],[0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0]];
- Tile0 = new TileClass(false,1,"wall");
- Tile1 = new TileClass(true,2,"blank");
- Tile2 = new TileClass(true,3,"pellet");
- Tile3 = new TileClass(true,4,"powerPellet");
- Tile4 = new TileClass(true,5,"keyLeft");
- Tile5 = new TileClass(true,6,"keyMiddle");
- Tile6 = new TileClass(true,7,"keyRight");
- Tile7 = new TileClass(false,8,"goalDoor");
- Tile8 = new DoorClass(11,19);
- Tile9 = new DoorClass(11,1);
- Tile10 = new TileClass(true,2,"goal");
- Tile11 = new TileClass(false,11,"openGoalDoor");
- _root.createEmptyMovieClip("controller",10);
- controller.onEnterFrame = function()
- {
- if(game.interaction)
- {
- moveHero();
- enemyBrain();
- if(game.powerUp >= 0)
- {
- powerUpCount();
- }
- }
- };
- Enemy1 = new EnemyClass(1);
- Enemy2 = new EnemyClass(1);
- Enemy3 = new EnemyClass(1);
- enemyList = [[0],[[1,7,5],[2,15,5],[3,11,7]]];
- hero = {curDir:0,nextDir:0,xTile:11,yTile:15,speed:5.25};
- myKeyListener = {};
- Key.addListener(myKeyListener);
- myKeyListener.onKeyDown = function()
- {
- if(game.interaction)
- {
- var _loc1_ = 0;
- switch(Key.getCode())
- {
- case 38:
- _loc1_ = 1;
- break;
- case 39:
- _loc1_ = 2;
- break;
- case 40:
- _loc1_ = 3;
- break;
- case 37:
- _loc1_ = 4;
- break;
- case 32:
- _loc1_ = 5;
- }
- if(_loc1_ != hero.curDir && _loc1_ != hero.nextDir)
- {
- if(hero.curDir == 0)
- {
- hero.curDir = _loc1_;
- hero.nextDir = 0;
- }
- else
- {
- hero.nextDir = _loc1_;
- }
- }
- }
- };
- buildMap(_root["map" + game.currentMap],true);
-